<!DOCTYPE html>
<html lang="en">
  <head>
    
      <title>阿里云ubuntu服务器配置mysql :: Rennan Blog — We can exchange and study together</title>
    
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<meta name="description" content="检查是否安装了过，以防安装不成功
[root@localhost ~]# rpm -qa | grep mysql或[root@localhost ~]# yum list installed | grep mysql删除原先安装的mysql库
rpm -e --nodeps 文件名下载mysql安装包
rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm安装mysql
[root@localhost ~]# yum install -y mysql-server或[root@localhost ~]# yum install mysql-community-server如果显示以下内容说明安装成功 Complete! 设置开机启动mysql
systemctl enable mysqld.service检查是否安装了开机自动启动
systemctl list-unit-files | grep mysqld如果显示以下内容说明已经完成自动启动安装 mysqld.service enabled 设置开启服务
systemctl start mysqld.servicemysql密码默认为空
 配置远程连接 进入mysql数据库(默认密码为空)
mysql -uroot -p开启远程登录
mysql&amp;gt;GRANT ALL PRIVILEGES ON *."/>
<meta name="keywords" content=""/>
<meta name="robots" content="noodp"/>
<link rel="canonical" href="/my_blog/post/aliyunmysql/" />





<link rel="stylesheet" href="/my_blog/assets/style.css">


<link rel="stylesheet" href="/my_blog/style.css">


<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/my_blog/img/apple-touch-icon-144-precomposed.png">
<link rel="shortcut icon" href="/my_blog/img/favicon.png">


<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="阿里云ubuntu服务器配置mysql"/>
<meta name="twitter:description" content="阿里云服务配置MySQL完整教程"/>



<meta property="og:title" content="阿里云ubuntu服务器配置mysql" />
<meta property="og:description" content="阿里云服务配置MySQL完整教程" />
<meta property="og:type" content="article" />
<meta property="og:url" content="/my_blog/post/aliyunmysql/" />
<meta property="article:published_time" content="2018-05-25T00:00:00+00:00" />
<meta property="article:modified_time" content="2018-05-25T00:00:00+00:00" /><meta property="og:site_name" content="Rennan Blog" />






  </head>
  <body class="">
    <div class="container">
      <header class="header">
  <span class="header__inner">
    <a href="/my_blog/hello/" class="logo" style="text-decoration: none;">
  
    <span class="logo__mark"><svg xmlns="http://www.w3.org/2000/svg" class="greater-icon" viewBox="0 0 44 44">
  <path fill="none" d="M15 8l14.729 14.382L15 35.367"/>
</svg>
</span>
    <span class="logo__text">Welcome To MyBlog</span>
    <span class="logo__cursor"></span>
  
</a>

    <span class="header__right">
      
        <nav class="menu">
  <ul class="menu__inner menu__inner--desktop">
    
      
        
          <li><a href="/my_blog/resume">resume</a></li>
        
      
        
          <li><a href="/my_blog/vue">vue</a></li>
        
      
      
    
  </ul>

  <ul class="menu__inner menu__inner--mobile">
    
      
        <li><a href="/my_blog/resume">resume</a></li>
      
    
      
        <li><a href="/my_blog/vue">vue</a></li>
      
    
  </ul>
</nav>

        <span class="menu-trigger">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
            <path d="M0 0h24v24H0z" fill="none"/>
            <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>
          </svg>
        </span>
      
      <span class="theme-toggle">
        <svg class="theme-toggler" width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
  <path d="M22 41C32.4934 41 41 32.4934 41 22C41 11.5066 32.4934 3 22
  3C11.5066 3 3 11.5066 3 22C3 32.4934 11.5066 41 22 41ZM7 22C7
  13.7157 13.7157 7 22 7V37C13.7157 37 7 30.2843 7 22Z"/>
</svg>

      </span>
    </span>
  </span>
</header>


      <div class="content">
        
  
  

  <div class="post">
    <h2 class="post-title"><a href="/my_blog/post/aliyunmysql/">阿里云ubuntu服务器配置mysql</a></h2>
    <div class="post-meta">
      
        <span class="post-date">
          25056-08-25
        </span>

        
          
        
      

      <span class="post-author">— Written by ren nan</span>
      
    </div>

    

    

    <div class="post-content">
      <p><strong>检查是否安装了过，以防安装不成功</strong></p>
<pre><code>[root@localhost ~]# rpm -qa | grep mysql
或
[root@localhost ~]# yum list installed | grep mysql
</code></pre><p>删除原先安装的mysql库</p>
<pre><code>rpm -e  --nodeps 文件名
</code></pre><p><strong>下载mysql安装包</strong></p>
<pre><code>rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
</code></pre><p><strong>安装mysql</strong></p>
<pre><code>[root@localhost ~]# yum install -y mysql-server
或
[root@localhost ~]# yum install mysql-community-server
</code></pre><p>如果显示以下内容说明安装成功
Complete!
<strong>设置开机启动mysql</strong></p>
<pre><code>systemctl enable mysqld.service
</code></pre><p><strong>检查是否安装了开机自动启动</strong></p>
<pre><code>systemctl list-unit-files | grep mysqld
</code></pre><p>如果显示以下内容说明已经完成自动启动安装
mysqld.service enabled
<strong>设置开启服务</strong></p>
<pre><code>systemctl start mysqld.service
</code></pre><p><strong>mysql密码默认为空</strong></p>
<hr>
<h2 id="配置远程连接">配置远程连接</h2>
<p><strong>进入mysql数据库(默认密码为空)</strong></p>
<pre><code>mysql -uroot -p
</code></pre><p>开启远程登录</p>
<pre><code>mysql&gt;GRANT ALL PRIVILEGES ON *.* TO '用户'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;   
</code></pre><p><strong>命令立即生效</strong></p>
<pre><code>mysql&gt;flush privileges;
</code></pre><p>远程配置成功!!!
配置成功后在阿里云服务器后台设置&quot;安全组配置&rdquo;
开启指定端口号</p>
<p><strong>参考博客： <a href="https://blog.csdn.net/qq_40241957/article/details/90343651">https://blog.csdn.net/qq_40241957/article/details/90343651</a></strong></p>

    </div>
    
      
        <div class="pagination">
          <div class="pagination__title">
            <span class="pagination__title-h">Read other posts</span>
            <hr />
          </div>
          <div class="pagination__buttons">
            
              <span class="button previous">
                <a href="/my_blog/post/vuefilters/">
                  <span class="button__icon">←</span>
                  <span class="button__text">vue中filters的指向问题</span>
                </a>
              </span>
            
            
              <span class="button next">
                <a href="/my_blog/post/concurrent/">
                  <span class="button__text">Python中的not，and，or</span>
                  <span class="button__icon">→</span>
                </a>
              </span>
            
          </div>
        </div>
      
    


    
      
        

      
    

    </div>

      </div>

      
        <footer class="footer">
  <div class="footer__inner">
    
      <a href="/my_blog/hello/" class="logo" style="text-decoration: none;">
  
    <span class="logo__mark"><svg xmlns="http://www.w3.org/2000/svg" class="greater-icon" viewBox="0 0 44 44">
  <path fill="none" d="M15 8l14.729 14.382L15 35.367"/>
</svg>
</span>
    <span class="logo__text">Welcome To MyBlog</span>
    <span class="logo__cursor"></span>
  
</a>

      <div class="copyright">
        <span>© 2020 Powered by <a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a></span>
        <span>Theme created by <a href="https://twitter.com/panr" target="_blank" rel="noopener">panr</a></span>
      </div>
    
  </div>
</footer>

<script src="/my_blog/assets/main.js"></script>
<script src="/my_blog/assets/prism.js"></script>


      
    </div>

    
  </body>
</html>
